<template>
  <van-nav-bar class="mybar" fixed="true" placeholder="true" title="标题"
  @click-right="onClickRight">
  <template #right>
    <van-icon name="search" size="20" />
  </template>
  </van-nav-bar>
</template>

<script>
import { NavBar } from 'vant';
import { Icon } from 'vant';
import { useRouter } from "vue-router";
export default {
    components : {
        'van-nav-bar' : NavBar,
        'van-icon' : Icon
    },
    setup() {
      const router = useRouter();
      const serch = function(){
        router.push({path : '/serch'})
      }
      const onClickRight = () => serch();
      return {
        onClickRight,
      };
    },
    methods: {
    }
}
</script>

<style scoped>
.mybar{
     --van-nav-bar-height: 3em;
     --van-nav-bar-background-color: whitesmoke;
     --van-nav-bar-title-font-size : 1.5em
     /* background-color: whitesmoke; */
}
</style>